package com.smcdd.cdb.dbo.cdb_dbo.ui.activity;

import android.widget.ImageView;
import android.widget.TextView;

import com.smcdd.cdb.dbo.cdb_dbo.R;
import com.smcdd.cdb.dbo.cdb_dbo.service.presenter.GetHardwarePresenter;
import com.smcdd.cdb.dbo.cdb_dbo.service.view.IGetHardware;
import com.smcdd.cdb.dbo.cdb_dbo.ui.base.BaseActivity;

/**
 * 作者：Administrator on 2017/7/13 18:40
 * 邮箱：zhanghuaiha@gmail.com
 */

public class GetHardwareActivity extends BaseActivity<IGetHardware,GetHardwarePresenter> implements IGetHardware {
    private ImageView back;
    private TextView save,id,name,tel,describe,time;
    private String alias;
    private String user;
    private String mobile;
    private String times;
    private String remark;

    @Override
    public void initView() {
        back = (ImageView) findViewById(R.id.hardware_back);
        save = (TextView) findViewById(R.id.hardware_save);
        id = (TextView) findViewById(R.id.hardware_id);
        name = (TextView) findViewById(R.id.hardware_name);
        tel = (TextView) findViewById(R.id.hardware_tel);
        describe = (TextView) findViewById(R.id.hardware_describe);
        time = (TextView) findViewById(R.id.hardware_time);
    }

    @Override
    public void initData() {
        alias = getIntent().getStringExtra("alias");
        user = getIntent().getStringExtra("name");
        mobile = getIntent().getStringExtra("mobile");
        times = getIntent().getStringExtra("time");
        remark = getIntent().getStringExtra("remark");

        name.setText(user);
        id.setText(alias);
        tel.setText(mobile);
        describe.setText(remark);
        time.setText(times);

        mPresenter.loadDate();
    }

    @Override
    public void initListener() {
        back.setOnClickListener(v -> finish());
        save.setOnClickListener(v -> mPresenter.save(alias));
    }

    @Override
    protected GetHardwarePresenter createPresenter() {
        return new GetHardwarePresenter(this);
    }

    @Override
    protected int provideContentViewId() {
        return R.layout.activity_hardware_report;
    }
}
